import pytest

# @pytest.fixture(scope="session", autouse=True)
# def before():
#     print("----------->before")
#
# @pytest.fixture(scope="module", autouse=True)
# def moduleFix():
#     print("----------->moduleFix")

def pytest_addoption(parser):
    """
    定义自定义参数, 函数名写死, 接收参数parser
    """
    parser.addoption(
        "--caseId", action="store", help="test：表示测试环境，默认test环境"
    )


@pytest.fixture(scope='function', autouse=True)
def getCaseId(request):
    return request.config.getoption('--caseId')  # 获取传入的caseId 为每一个用例传入caseId